﻿@model QuestionListViewModel

<section id="question-mini-list">
    <header class="subheader">
        <h1 id="h-top-questions">Latest questions</h1>
        <div id="tabs">
            @Html.ActionLink("newest", 
                             "Index", 
                             "Question",
                             null, 
                             new { @title = "questions asked recently",
                                   @class = Html.MatchRouteData("Question", "Index") ? "youarehere" : String.Empty })

            @Html.ActionLink("hot", 
                             "Hottest", 
                             "Question", 
                             null, 
                             new { @title = "questions with most upvoted answers",
                                   @class = Html.MatchRouteData("Question", "Hottest") ? "youarehere" : String.Empty })
        </div>
    </header>
    @foreach (var item in Model.Items)
    {
        <div class="question-summary narrow">
            <div class="cp">
                <div class="votes">
                    <div class="mini-counts">@item.Score</div>
                    <div>votes</div>
                </div>
                <div class="status unanswered">
                    <div class="mini-counts">@item.AnswersCount</div>
                    <div>answers</div>
                </div>
                <div class="views">
                    <div class="mini-counts">@item.Views</div>
                    <div>views</div>
                </div>
            </div>
            <div class="summary">
                <h3>
                    @Html.ActionLink(item.Title, "Details", new { id = item.QuestionId }, new { @class = "question-hyperlink" })</h3>
                <div class="post-taglist">
                    @foreach (var tag in item.Tags)
                    {
                        @Html.ActionLink(tag,
                                         "ByTag",
                                         "Question",
                                         new { id = tag },
                                         new { @class = "post-tag" })
                    }
                </div>
                <div class="started">
                    @item.PostedOn.ToString("dddd, MMM dd yyyy")
                    <a href="@Url.Action("Details", "User", new { id = item.Author.UserId })">@item.Author.UserName</a>
                </div>
            </div>
        </div>
    }
    <div class="cbt"></div>

    <footer class="question-list-footer">
        @if (Model.PreviousPageIndex.HasValue)
        { 
            @Html.ActionLink("Previous page",
                             (String)ViewContext.RouteData.Values["action"],
                             "Question",
                             new { pageIndex = Model.PreviousPageIndex.Value }, 
                             new {@class = "prev"})
        }
        
        @if (Model.NextPageIndex.HasValue)
        { 
            @Html.ActionLink("Next page",
                             (String)ViewContext.RouteData.Values["action"],
                             "Question",
                             new { pageIndex = Model.NextPageIndex.Value }, 
                             new {@class = "next"})
        }
    </footer>
</section>
@section Sidebar {
    <div id="sidebar">
        <div class="module newuser" id="newuser-box">
            <h4>Welcome!</h4>
            <div>
                <p>
                    <strong>DotNetToscana</strong> is the Tuscany User Group about Microsoft .NET.
                </p>
                <p>
                    We are a non-profit group made ​​up of people with a strong passion for computer science and, in
                    particular, for products and technologies related to Microsoft .NET Framework. Our main focus
                    is to facilitate dialogue and the knowledge exchange and experiences among people who live, study
                    and / or work in Tuscany.
                </p>
            </div>
        </div>
        @{
            Html.RenderAction("TagList", "SideBar");
        }
    </div>
    <div id="feed-link">
        <div id="feed-link-text">
            <a href="@Url.Action("Index", "Feed")" title="the 10 most recent questions">
                <span class="feed-icon"></span>recent questions feed</a>
        </div>
    </div>
}